﻿@model List<CMP.ERP.Admin.ServiceReference1.FORMDHLUPSInfo>
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>千里马ERP欢迎您!!!</title>
    @*<link rel="stylesheet" href="~/css/bootstrap.css" />
        <link rel="stylesheet" href="~/css/css.css" />
        <link href="~/Content/Site.css" rel="stylesheet" />
        <script type="text/javascript" src="~/js/jquery1.9.0.min.js"></script>
        <script type="text/javascript" src="~/js/bootstrap.min.js"></script>
        <script type="text/javascript" src="~/js/sdmenu.js"></script>
        <script type="text/javascript" src="~/js/laydate/laydate.js"></script>*@
    <link href="~/Scripts/js1/css1/bootstrap.css" rel="stylesheet" />
    <link href="~/Scripts/js1/css1/css.css" rel="stylesheet" />
    <link href="~/Scripts/js1/css1/Site.css" rel="stylesheet" />
    <script src="~/Scripts/js1/js/jquery1.9.0.min.js"></script>
    <script src="~/Scripts/js1/js/bootstrap.min.js"></script>
    <script src="~/Scripts/js1/js/sdmenu.js"></script>
    <script src="~/Scripts/js1/js/laydate/laydate.js"></script>
    @*<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script src="~/Scripts/js1/js/js/jquery-1.8.3.min.js"></script>
        <script src="~/Scripts/js1/js/js/raphael-min.js"></script>
        <script src="~/Scripts/js1/js/js/script.js"></script>*@
    <meta charset="utf-8">
    <title>Bootstrap Admin</title>
    <meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <link href="~/Scripts/lib/bootstrap/css/bootstrap.css" rel="stylesheet" />

    <link href="~/Scripts/stylesheets/theme.css" rel="stylesheet" />
    <link href="~/Scripts/lib/font-awesome/css/font-awesome.css" rel="stylesheet" />

    <script src="~/Scripts/lib/jquery-1.7.2.min.js"></script>

    <!-- Demo page code -->

    <style type="text/css">
        #line-chart {
            height: 300px;
            width: 800px;
            margin: 0px auto;
            margin-top: 1em;
        }

        .brand {
            font-family: georgia, serif;
        }

            .brand .first {
                color: #ccc;
                font-style: italic;
            }

            .brand .second {
                color: #fff;
                font-weight: bold;
            }
    </style>

</head>
<body>
    <div class="navbar">
        <div class="navbar-inner">
            <ul class="nav pull-right">

                <li><a href="#" class="hidden-phone visible-tablet visible-desktop" role="button">Settings</a></li>
                <li id="fat-menu" class="dropdown">
                    <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">
                        <i class="icon-user"></i> @Session["Username"]
                        <i class="icon-caret-down"></i>
                    </a>

                    <ul class="dropdown-menu">
                        <li><a tabindex="-1" href="#">My Account</a></li>
                        <li class="divider"></li>
                        <li><a tabindex="-1" class="visible-phone" href="#">Settings</a></li>
                        <li class="divider visible-phone"></li>
                        <li><a tabindex="-1" href="/Home/Login">Logout</a></li>
                    </ul>
                </li>

            </ul>
            <a class="brand">
                <span>
                    <img src="~/1234.jpg" style="width:50px;height:50px; border-radius:25px;cursor:pointer" onclick="fun()" />
                </span><span class="first" style="font-family:华文彩云;font-size:22px">千  里  马  </span>&nbsp;&nbsp;<span class="second " style="font-size:22px;">   E R P</span>
            </a>
        </div>
    </div>
    <div class="header">


        <div class="header-right">


            
                <div id="modal-container-973559" class="modal hide fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="width:400px; margin-left:-150px;">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                        <h3 id="myModalLabel">
                            千里马客户新增系统
                        </h3>
                    </div>
                    <div class="modal-body">       
                        <select id="select1">
                            <option value="">-请选择-</option>
                        </select>
                        <div id="div1" style="width:200px;height:80px;"></div>
                        
                    </div>
                    <div class="modal-footer">
                        <button class="btn" data-dismiss="modal" aria-hidden="true">关闭</button> <button type="submit" class="btn btn-default" value="修改" onclick="update()"><span class="icon-inbox"></span>保存</button>
                    </div>
                </div>
            
        </div>
    </div>
    @*<script>
            function Cus_Add()
            {
                $.ajax({
                    Type: "post",
                    Url: "/Custom_Info/Custom_Info_Add",
                    data: {
                        Name: $("input['name=Custom_Info_Name']").val(),
                        Nick: $("input['name=Custom_Info_Nick']")
                    }
                })
            }
        </script>*@
    <!-- 顶部 -->

    <div id="middle">
        <div class="left">
            <div class="sidebar-nav">
                <a href="#dashboard-menu" class="nav-header" data-toggle="collapse"><i class="icon-dashboard"></i>基础信息</a>
                <ul id="dashboard-menu" class="nav nav-list collapse in">
                    <li><a href="/Client/Client_Show">客户管理</a></li>
                    <li><a href="/Provider/Provider_show">快递公司</a></li>
                    <li><a href="/Experss/Experss_Show">供应商</a></li>
                    <li><a href="/Express_mate/Exress_mate_Show">快递匹配</a></li>
                    <li><a href="/calendar/calendar_Show">仓库</a></li>
                    <li><a href="/Inventory/ShowInventory">库存管理</a></li>
                </ul>

                <a href="#accounts-menu" class="nav-header" data-toggle="collapse"><i class="icon-briefcase"></i>商品管理</a>
                <ul id="accounts-menu" class="nav nav-list collapse">
                    <li><a href="/Blurb/Blurb_Show">商品信息</a></li>
                    @*<li><a href="/Brand/Brand_Show">商品品牌</a></li>
                    <li><a href="/Category/Category_Show">商品分类</a></li>
                    <li><a href="/Report/Report_Show">商品报表</a></li>*@
                </ul>

                <a href="#error-menu" class="nav-header collapsed" data-toggle="collapse"><i class="icon-exclamation-sign"></i>订单管理@*<i class="icon-chevron-up"></i>*@</a>
                <ul id="error-menu" class="nav nav-list collapse">
                    <li><a href="/Order/Order_Show">新增订单</a></li>
                    <li><a href="/Order/Order_details">订单信息</a></li><li><a href="/Order/SelShow">订单报表</a></li>
                </ul>

                <a href="#legal-menu" class="nav-header" data-toggle="collapse"><i class="icon-legal"></i>采购管理</a>
                <ul id="legal-menu" class="nav nav-list collapse">
                    <li><a href="/Procurement/Procurement_Show">采购订单</a></li>
                    <li><a href="/Stock/Stock_Show">入库信息</a></li>
                </ul>

                <a href="#leaf-menu" class="nav-header" data-toggle="collapse"><i class="icon-leaf"></i>系统设置</a>
                <ul id="leaf-menu" class="nav nav-list collapse">
                    <li><a href="/Shop/Shop_Show">店铺管理</a></li>
                    <li><a href="/Account/Account_Show">账号管理</a></li>
                </ul>
                @*<a href="help.html" class="nav-header"><i class="icon-question-sign"></i>店铺管理</a>
            <a href="faq.html" class="nav-header"><i class="icon-comment"></i>账号管理</a>*@
            </div>

        </div>
        <div class="Switch"></div>
        <script type="text/javascript">
            $(document).ready(function (e) {
                $(".Switch").click(function () {
                    $(".left").toggle();

                });
            });
        </script>

        <div class="right" id="mainFrame">

            <div class="right_cont">
                <ul class="breadcrumb">
                    当前位置：
                    <a href="/Home/Index">首页</a>
                    <span class="divider">/</span>
                    快递匹配
                </ul>
                <div class="title_right"><strong>快递快速匹配</strong></div>
                <div style="width:100%; margin:auto">

                    <div style="margin-top:20px;">
                        <button id="modal-973559" href="#modal-container-973559" role="button" type="button" class="btn btn-default" data-toggle="modal"><span class="icon-plus"></span>新增</button>
                        <table class="table  table-hover table-bordered table-striped">
                            <thead>
                                <tr>
                                    <th>快递编码</th>
                                    <th>快递名称</th>
                                    <th>发货范围（省/市）</th>
                                </tr>
                            </thead>
                            <tbody id="tbody1">

                            </tbody>
                        </table>
                    </div>
                    
                </div>

                
            </div>
        </div>
    </div>

    <!-- 底部 -->
    <div id="footer">版权所有：千里马ERP</div>



    <script>
        !function () {
            laydate.skin('molv');
            laydate({ elem: '#Calendar' });
        }();

        function fun() {
            location.href = '/Home/Index';
        }
        //显示快递匹配
        $(function () {
            $.ajax({
                type: "get",
                //单表显示快递名称
                url: "/Express_mate/kuaidiname",
                success: function (data) {
                    $(data).each(function (index, item) {
                        var s1 = '<tr><td>' + item.DHLUPSFEDEXEMSID + '</td><td>' + item.DHLUPSFEDEXEMSName + '</td><td><span id="aa' + item.DHLUPSFEDEXEMSID + '"></span></td></tr>';
                        $("#tbody1").append(s1);
                        var did = item.DHLUPSFEDEXEMSID;
                        $.ajax({
                            type: "get",
                            //根据快递编号搜索显示城市
                            url: "/Express_mate/Exress_mate_Show1",
                            data: {
                                did:did
                            },
                            cache:false,
                            success: function (data) {
                                var cit="";
                                $(data).each(function (index, item) {
                                    cit += item.CityName + ','; 
                                })
                                cit = cit.substr(0, cit.length - 1);
                                $("#aa" + did + "").html(cit);
                            }
                        })
                    })
                }
            })
            //显示选项中的快递名称
            $.ajax({
                type: "get",
                url: "/Express_mate/kuaidiname",
                success: function (data) {
                    $(data).each(function (index, item) {
                        var str = '<option value="' + item.DHLUPSFEDEXEMSID + '">' + item.DHLUPSFEDEXEMSName + '</option>';
                        $("#select1").append(str);  
                    })
                }
            })
            //二次循环显示城市选项
            $.ajax({

                type: "get",
                url: "/Express_mate/GetidCity",
                asyn: false,
                data: {
                    pid:0
                },
                success: function (data) {
                    $(data).each(function (index, item) {
                        var str = '<span id="S'+item.CityID+'"><input type="checkbox" value="' + item.CityID + '" id="ss'+item.CityID+'" onclick="fun('+item.CityID+')"/>' + item.CityName + '<br /></span>';
                        $("#div1").append(str);
                        var pid = item.CityID;

                        $.ajax({
                            type: "get",
                            url: "/Express_mate/GetidCity",
                            asyn: false,
                            data:{
                                pid:pid
                            },
                            success: function (data) {
                                $(data).each(function (index, item) {
                                    var str1 = '<input type="checkbox" value="' + item.CityID + '" name="S' + pid + '"/>' + item.CityName + '';
                                    $("#S" + pid + "").append(str1);
                                })
                                var ss = "<br/>";
                                $("#S" + pid + "").append(ss);
                            }
                        })
                    })
                }
            })
            $("#select1").change(function () {
                $("input:checkbox").attr("checked", false);
                $.ajax({
                    type: "get",
                    url: "/Express_mate/FORMDHLUPSInfoGetid",
                    cache: false,
                    data: {
                        pid:$("#select1").val()
                    },
                    success: function (data) {
                        $(data).each(function (index, item)
                        {
                            $("input:checkbox").each(function ()
                            {
                                if ($(this).val() == item.CityID)
                                {
                                    $(this).attr("checked", true);
                                }
                            })
                        })
                    }
                })
            })
        })
        function fun(id) {
            var str = $("#ss" + id + "").attr("checked");
            if (str == "checked")
            {
                $(":checkbox[name='S" + id + "']").attr("checked", true);
            }
            else
            {
                $(":checkbox[name='S" + id + "']").removeAttr("checked");
            }
        }
        function update() {
            var time = (new Date()).valueOf();
            var str = "";
            $(":checkbox:checked").each(function () {
                str += $(this).val() + ",";
            })
            str = str.substr(0, str.length - 1);

            $.ajax({
                type: "post",
                url: "/Express_mate/Exress_mate_Update",
                data: {
                    pid: $("#select1").val(),
                    str:str
                },
                success: function (data) {
                    if (data > 0) {
                        alert("修改成功");
                        location.href = "/Express_mate/Exress_mate_Show";
                    }
                    else {
                        alert("修改失败");
                    }
                }
            })
        }
    </script>

</body>
</html>

